Skip to content

ci: 覆盖率门禁改用 cargo-nextest 运行 Rust 测试 - #248

Merged
sunerpy merged 1 commit into
mainfrom
ci/coverage-nextest
Nov 10, 2026
Merged

sunerpy merged 1 commit into
mainfrom
ci/coverage-nextest

Conversation

@sunerpy

@sunerpy sunerpy commented Nov 10, 2026

Copy link
Copy Markdown
Owner

问题

CI 的 verify · rust gates 里,覆盖率门禁(make coverage-gate)是最长的一步:最近 5 次 main 运行分别是 699、682、510、701、597 秒,中位数 682 秒。cargo llvm-cov 按二进制一个接一个地跑测试,101 个测试二进制自身用了 426 秒,其中 voltip-core 的 tests/long.rs 一个就 209 秒,其他二进制只能等它跑完。

改动

  • Makefile:coverage-gate 改为 cargo llvm-cov nextest,其余参数不变;没装 cargo-nextest 时直接报错。coverage-lcov 照旧从这次运行的数据生成 lcov。
  • .config/nextest.toml(新):fail-fast = false,一次报告所有失败;跑过 60 秒的测试标为 SLOW,跑过 10 分钟的被终止并记为 TIMEOUT,挂住的测试会在 CI 步骤的 25 分钟上限之前失败并在日志里留下名字。
  • ci.yml:CARGO_NEXTEST_VERSION: 0.9.151,用同一个 taiki-e/install-action(已钉 SHA,其清单里有 0.9.151)预编译安装。
  • AGENTS.md、docs/runbook.md:挂住的测试现在看 SLOW / TIMEOUT,不再是 libtest 的 "running for over 60 seconds"。

本机结果(32 核,构建已缓存)

原来(cargo llvm-cov) 现在(cargo llvm-cov nextest)
覆盖率门禁 431 秒 278 秒
测试 2086 个通过、42 个忽略 2086 个通过、42 个跳过
行覆盖率 92.95% 92.95%

profraw 文件 2311 个,共 796 MB。make verify(4573d07b)overall_exit=0,门禁 279 秒;rebase 到 #247 之后无冲突。

保留还是关闭

这次 PR 的 CI 运行(verify-rust-log)同时满足下面几条才合并,否则关闭这个 PR:

Verification

  • make verify(4573d07b):overall_exit=0
  • 发布脚本测试 219 个通过;actionlint .github/workflows/ci.yml
  • 上面的保留条件:看这次 PR 的 CI
  • No real host name, token or key in the change (.github/scripts/check-no-production-hosts.sh)

风险与回退

只改 CI 跑 Rust 测试的方式,产品代码不变。每个测试一个进程后,依赖同一进程里共享状态的测试会暴露出来;本机全量跑过,没有这类失败。回退就是还原这次提交。

`cargo llvm-cov` 按二进制一个接一个地跑测试:2026-11-10 的 CI 上 101 个测试二进制自身用了
426 秒,其中 voltip-core 的 tests/long.rs 一个就 209 秒,别的二进制只能等它跑完。

- Makefile:coverage-gate 改为 `cargo llvm-cov nextest`,参数不变,缺 cargo-nextest 时直接报错。
- .config/nextest.toml:失败全部报告(fail-fast = false);跑过 60 秒标为 SLOW,
  跑过 10 分钟终止并记为 TIMEOUT,挂住的测试在 CI 步骤的 25 分钟上限之前就失败并留下名字。
- ci.yml:cargo-nextest 0.9.151 由同一个 install-action 预编译安装(CARGO_NEXTEST_VERSION)。
- AGENTS.md、docs/runbook.md 同步说明。

本机 32 核、构建已缓存:覆盖率门禁 431 → 278 秒;2086 个测试通过、42 个跳过,与原来一致;
行覆盖率 92.95%,与原来一致。
@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
- Coverage   93.57%   93.55%   -0.02%     
==========================================
  Files         489      489              
  Lines       85860    85860              
  Branches     4909     4909              
==========================================
- Hits        80341    80329      -12     
- Misses       4850     4862      +12     
  Partials      669      669              
Flag Coverage Δ
rust 93.79% <ø> (-0.02%) ⬇️
web 92.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit 7dc5f70 into main Nov 10, 2026
16 checks passed
@sunerpy
sunerpy deleted the ci/coverage-nextest branch November 10, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant